<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template_dialog.xhtml">
	<ui:define name="head">
		<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}

.wrapper {
	overflow: hidden;
}
</style>
		<title>消息接收设置</title>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div class="full-center-content-scroll-noheader">
			<h:form id="infoForm">
				<p:growl id="msgs" showDetail="true"></p:growl>
				<p:panelGrid id="pg" style="width:100%;">
					<f:facet name="header">
						<p:row>
							<p:column colspan="4">
								<h:outputText value="基本信息" style="font-size:18px;" />
							</p:column>
						</p:row>
					</f:facet>
					<p:row>
						<p:column style="width:350px;">
							<p:outputLabel value="用户名：" />
						</p:column>
						<p:column style="width:350px;">
							<p:outputLabel value="#{mobileMessConfigController.user.code}" />
						</p:column>
						<p:column style="width:350px;">
							<p:outputLabel value="姓名： " />
						</p:column>
						<p:column>
							<p:outputLabel value="#{mobileMessConfigController.user.name}" />
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<p:outputLabel value="4A账号：" />
						</p:column>
						<p:column id="editColumn">
							<p:outputLabel value="#{mobileMessConfigController.person.account}" style="width:70%;"
								rendered="#{!mobileMessConfigController.editShow}" />
							<p:commandButton value="修改" rendered="#{!mobileMessConfigController.editShow}"
								actionListener="#{mobileMessConfigController.showEdit}" update="pg"
								style="width:20%;margin-left:5px;" process="@parent" />
							<p:inputText style="width:70%;" value="#{mobileMessConfigController.person.account}"
								rendered="#{mobileMessConfigController.editShow}" />
							<p:commandButton value="确认" actionListener="#{mobileMessConfigController.savePerson}"
								update="pg" style="width:20%;margin-left:5px;"
								rendered="#{mobileMessConfigController.editShow}" />
						</p:column>
						<p:column>
							<p:outputLabel value="电话：" />
						</p:column>
						<p:column>
							<p:outputLabel value="#{mobileMessConfigController.user.telephone}" />
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<p:outputLabel value="地址：" />
						</p:column>
						<p:column colspan="3">
							<p:outputLabel value="#{mobileMessConfigController.user.address}" />
						</p:column>
					</p:row>
				</p:panelGrid>
			</h:form>
			<h:form>
				<p:treeTable id="treeTable" widgetVar="treeTable" emptyMessage="无记录"
					value="#{mobileMessConfigController.root}" var="item" scrollable="true" scrollHeight="600">
					<f:facet name="header">
						<h:outputText value="消息接收设置" style="font-size:18px;" />
					</f:facet>
					<p:column headerText="名称">
						<h:outputText value="#{item.msgType.description}" />
					</p:column>
					<p:column headerText="接收方式">
						<p:selectManyCheckbox value="#{item.rec}" rendered="#{item.msgType.pid == null}"
							valueChangeListener="#{mobileMessConfigController.receiveChangeValue}">
							<f:selectItems value="#{mobileMessConfigController.recString}" var="rec"
								itemLabel="#{mobileMessConfigController.getStr(rec)}" itemValue="#{rec}" />
							<p:ajax event="change" listener="#{mobileMessConfigController.saveListConfig(item)}"
								update="treeTable infoForm:msgs" oncomplete="getRootColor()"></p:ajax>
						</p:selectManyCheckbox>
						<p:selectManyCheckbox id="basic" value="#{item.rec}" rendered="#{item.msgType.pid != null}"
							valueChangeListener="#{mobileMessConfigController.receiveChangeValue}">
							<f:selectItems value="#{mobileMessConfigController.recString}" var="rec"
								itemLabel="#{mobileMessConfigController.getStr(rec)}" itemValue="#{rec}" />
							<p:ajax event="change" listener="#{mobileMessConfigController.saveConfig(item)}"
								update="treeTable infoForm:msgs" oncomplete="getRootColor()"></p:ajax>
						</p:selectManyCheckbox>
					</p:column>
				</p:treeTable>
			</h:form>
			<h:inputHidden id="countRoot" value="#{mobileMessConfigController.countRoot}"></h:inputHidden>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script>
		  window.onload = function(){
			  getRootColor();
		  }
			function getRootColor(){
			var comId = "j_idt43:treeTable_node_";
			var num = 0;
			if ($('#countRoot')[0].defaultValue) {
				num = parseInt($('#countRoot')[0].defaultValue);
			}
			for (var i = 0; i &lt; num; i++) {
				var eleId = comId + i;
				var ele = document.getElementById(eleId);
				$(ele).css("background-color", "rgb(232, 232, 232)");
			}
		}
		</script>
	</ui:define>
</ui:composition>